#ifndef CNARROWITEM_H
#define CNARROWITEM_H

#include "cnitemcommon.h"
#include "icnitemcommon.h"
#include <QGraphicsPathItem>
/// 连接直线的操作方法，绘制直线，对引脚进行绘制

class CNPointItem;

class CNArrowItem : public QGraphicsPathItem, public ICNItemCommon
{
public:
    enum { Type = UserType + 4 };
    CNArrowItem(CNPointItem *startItem, CNPointItem *endItem, QGraphicsItem *parent = nullptr);

    QPainterPath shape() const override;

    void updatePosition();

    int type() const override;

    //void setType(CN::DiagramType type) override;// { m_Type = type; }

    QString name() const override;

    // 添加保存操作
    QJsonObject serialize() const override;

protected:
    void hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
    void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;

private:

    CNPointItem* m_pStartItem;
    CNPointItem* m_pEndItem;
};

#endif // CNARROWITEM_H
